

* Open log
capture log close
log using "Data analysis\cbld-management02", replace text


* **********************************
* Consensus rates expected by chance
* **********************************

* Programme:	cbld-management02.do
* Project:		Council coalition building
* Author:		Frank Haege, Department of Politics and Administration, University of Limerick
* Contact:		frank.haege@ul.ie

* Description
*************
* This do-file generates data about consensus rates expected by chance for different 
* membership sizes (i.e. consensual and non-consensual decisions are equally likely)


* Set up Stata
version 11
clear all
macro drop _all
set linesize 80
set more off

* Set number of observations
set obs 3

* Generate membership size variable
generate nostates = .
replace nostates = 12 if _n == 1
replace nostates = 15 if _n == 2
replace nostates = 25 if _n == 3
label var nostates "Number of member states"
tab nostates, m

* Generate consensus rate expected by chance
generate econsensus = 0.5
label var econsensus "Expected consensus (chance)"

* Generate standard error of expected consensus rate
generate ese = sqrt((econsensus * (1 - econsensus)) / 1000)
label var ese "Standard error (null)"

* Generate lower and upper bound of confidence interval of consensus rate
generate elowerci = (econsensus - (1.96 * ese))
label var elowerci "CI lower bound (null)"
generate eupperci = (econsensus + (1.96 * ese))
label var eupperci "CI upper bound (null)"

* Save data set
sort nostates
save "Experiments\Other data\cbld-management02.dta", replace


* Exit do-file
log close
exit
